"use strict";var De=Object.create;var K=Object.defineProperty;var me=Object.getOwnPropertyDescriptor;var xe=Object.getOwnPropertyNames;var Se=Object.getPrototypeOf,Ae=Object.prototype.hasOwnProperty;var he=(e,n)=>{for(var s in n)K(e,s,{get:n[s],enumerable:!0})},C=(e,n,s,T)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of xe(n))!Ae.call(e,o)&&o!==s&&K(e,o,{get:()=>n[o],enumerable:!(T=me(n,o))||T.enumerable});return e},N=(e,n,s)=>(C(e,n,"default"),s&&C(s,n,"default")),Be=(e,n,s)=>(s=e!=null?De(Se(e)):{},C(n||!e||!e.__esModule?K(s,"default",{value:e,enumerable:!0}):s,e)),ke=e=>C(K({},"__esModule",{value:!0}),e);var P={};he(P,{ApiProvider:()=>Re,createApi:()=>Me,reactHooksModule:()=>ie,reactHooksModuleName:()=>re});module.exports=ke(P);var Z=require("@reduxjs/toolkit/query");var We=require("@reduxjs/toolkit");var ye=require("@reduxjs/toolkit"),He=require("@reduxjs/toolkit"),W=require("@reduxjs/toolkit"),t=require("react"),F=require("@reduxjs/toolkit/query"),ne=require("react-redux");var v=require("react");function ee(e,n,s,T){let o=(0,v.useMemo)(()=>({queryArgs:e,serialized:typeof e=="object"?n({queryArgs:e,endpointDefinition:s,endpointName:T}):e}),[e,n,s,T]),B=(0,v.useRef)(o);return(0,v.useEffect)(()=>{B.current.serialized!==o.serialized&&(B.current=o)},[o]),B.current.serialized===o.serialized?B.current.queryArgs:e}var V=Symbol();var _=require("react"),te=require("react-redux");function j(e){let n=(0,_.useRef)(e);return(0,_.useEffect)(()=>{(0,te.shallowEqual)(n.current,e)||(n.current=e)},[e]),(0,te.shallowEqual)(n.current,e)?n.current:e}var y=require("@reduxjs/toolkit");var ae=WeakMap?new WeakMap:void 0,ue=({endpointName:e,queryArgs:n})=>{let s="",T=ae?.get(n);if(typeof T=="string")s=T;else{let o=JSON.stringify(n,(B,h)=>(0,y.isPlainObject)(h)?Object.keys(h).sort().reduce((k,b)=>(k[b]=h[b],k),{}):h);(0,y.isPlainObject)(n)&&ae?.set(n,o),s=o}return`${e}(${s})`};var be=typeof window<"u"&&window.document&&window.document.createElement?t.useLayoutEffect:t.useEffect,Ee=e=>e.isUninitialized?{...e,isUninitialized:!1,isFetching:!0,isLoading:e.data===void 0,status:F.QueryStatus.pending}:e;function pe({api:e,moduleOptions:{batch:n,hooks:{useDispatch:s,useSelector:T,useStore:o},unstable__sideEffectsInRender:B},serializeQueryArgs:h,context:k}){let b=B?r=>r():t.useEffect;return{buildQueryHooks:E,buildMutationHook:z,usePrefetch:Y};function J(r,Q,f){if(Q?.endpointName&&r.isUninitialized){let{endpointName:d}=Q,c=k.endpointDefinitions[d];h({queryArgs:Q.originalArgs,endpointDefinition:c,endpointName:d})===h({queryArgs:f,endpointDefinition:c,endpointName:d})&&(Q=void 0)}let g=r.isSuccess?r.data:Q?.data;g===void 0&&(g=r.data);let u=g!==void 0,a=r.isLoading,i=!u&&a,p=r.isSuccess||a&&u;return{...r,data:g,currentData:r.data,isFetching:a,isLoading:i,isSuccess:p}}function Y(r,Q){let f=s(),g=j(Q);return(0,t.useCallback)((u,a)=>f(e.util.prefetch(r,u,{...g,...a})),[r,f,g])}function E(r){let Q=(u,{refetchOnReconnect:a,refetchOnFocus:i,refetchOnMountOrArgChange:p,skip:d=!1,pollingInterval:c=0}={})=>{let{initiate:m}=e.endpoints[r],R=s(),l=(0,t.useRef)();if(!l.current){let M=R(e.internalActions.internal_getRTKQSubscriptions());l.current=M}let S=ee(d?F.skipToken:u,ue,k.endpointDefinitions[r],r),x=j({refetchOnReconnect:a,refetchOnFocus:i,pollingInterval:c}),A=(0,t.useRef)(!1),D=(0,t.useRef)(),{queryCacheKey:O,requestId:q}=D.current||{},w=!1;O&&q&&(w=l.current.isRequestSubscribed(O,q));let H=!w&&A.current;return b(()=>{A.current=w}),b(()=>{H&&(D.current=void 0)},[H]),b(()=>{let M=D.current;if(typeof process<"u",S===F.skipToken){M?.unsubscribe(),D.current=void 0;return}let I=D.current?.subscriptionOptions;if(!M||M.arg!==S){M?.unsubscribe();let X=R(m(S,{subscriptionOptions:x,forceRefetch:p}));D.current=X}else x!==I&&M.updateSubscriptionOptions(x)},[R,m,p,S,x,H]),(0,t.useEffect)(()=>()=>{D.current?.unsubscribe(),D.current=void 0},[]),(0,t.useMemo)(()=>({refetch:()=>{if(!D.current)throw new Error((0,ye.formatProdErrorMessage)(38));return D.current?.refetch()}}),[])},f=({refetchOnReconnect:u,refetchOnFocus:a,pollingInterval:i=0}={})=>{let{initiate:p}=e.endpoints[r],d=s(),[c,m]=(0,t.useState)(V),R=(0,t.useRef)(),l=j({refetchOnReconnect:u,refetchOnFocus:a,pollingInterval:i});b(()=>{let A=R.current?.subscriptionOptions;l!==A&&R.current?.updateSubscriptionOptions(l)},[l]);let S=(0,t.useRef)(l);b(()=>{S.current=l},[l]);let x=(0,t.useCallback)(function(A,D=!1){let O;return n(()=>{R.current?.unsubscribe(),R.current=O=d(p(A,{subscriptionOptions:S.current,forceRefetch:!D})),m(A)}),O},[d,p]);return(0,t.useEffect)(()=>()=>{R?.current?.unsubscribe()},[]),(0,t.useEffect)(()=>{c!==V&&!R.current&&x(c,!0)},[c,x]),(0,t.useMemo)(()=>[x,c],[x,c])},g=(u,{skip:a=!1,selectFromResult:i}={})=>{let{select:p}=e.endpoints[r],d=ee(a?F.skipToken:u,h,k.endpointDefinitions[r],r),c=(0,t.useRef)(),m=(0,t.useMemo)(()=>(0,W.createSelector)([p(d),(A,D)=>D,A=>d],J),[p,d]),R=(0,t.useMemo)(()=>i?(0,W.createSelector)([m],i,{devModeChecks:{identityFunctionCheck:"never"}}):m,[m,i]),l=T(A=>R(A,c.current),ne.shallowEqual),S=o(),x=m(S.getState(),c.current);return be(()=>{c.current=x},[x]),l};return{useQueryState:g,useQuerySubscription:Q,useLazyQuerySubscription:f,useLazyQuery(u){let[a,i]=f(u),p=g(i,{...u,skip:i===V}),d=(0,t.useMemo)(()=>({lastArg:i}),[i]);return(0,t.useMemo)(()=>[a,p,d],[a,p,d])},useQuery(u,a){let i=Q(u,a),p=g(u,{selectFromResult:u===F.skipToken||a?.skip?void 0:Ee,...a}),{data:d,status:c,isLoading:m,isSuccess:R,isError:l,error:S}=p;return(0,t.useDebugValue)({data:d,status:c,isLoading:m,isSuccess:R,isError:l,error:S}),(0,t.useMemo)(()=>({...p,...i}),[p,i])}}}function z(r){return({selectFromResult:Q,fixedCacheKey:f}={})=>{let{select:g,initiate:u}=e.endpoints[r],a=s(),[i,p]=(0,t.useState)();(0,t.useEffect)(()=>()=>{i?.arg.fixedCacheKey||i?.reset()},[i]);let d=(0,t.useCallback)(function(X){let oe=a(u(X,{fixedCacheKey:f}));return p(oe),oe},[a,u,f]),{requestId:c}=i||{},m=(0,t.useMemo)(()=>g({fixedCacheKey:f,requestId:i?.requestId}),[f,i,g]),R=(0,t.useMemo)(()=>Q?(0,W.createSelector)([m],Q):m,[Q,m]),l=T(R,ne.shallowEqual),S=f==null?i?.arg.originalArgs:void 0,x=(0,t.useCallback)(()=>{n(()=>{i&&p(void 0),f&&a(e.internalActions.removeMutationResult({requestId:c,fixedCacheKey:f}))})},[a,f,i,c]),{endpointName:A,data:D,status:O,isLoading:q,isSuccess:w,isError:H,error:M}=l;(0,t.useDebugValue)({endpointName:A,data:D,status:O,isLoading:q,isSuccess:w,isError:H,error:M});let I=(0,t.useMemo)(()=>({...l,originalArgs:S,reset:x}),[l,S,x]);return(0,t.useMemo)(()=>[d,I],[d,I])}}}function de(e){return e.type==="query"}function ce(e){return e.type==="mutation"}function $(e){return e.replace(e[0],e[0].toUpperCase())}function L(e,...n){return Object.assign(e,...n)}var U=require("react-redux");var re=Symbol(),ie=({batch:e=U.batch,hooks:n={useDispatch:U.useDispatch,useSelector:U.useSelector,useStore:U.useStore},unstable__sideEffectsInRender:s=!1,...T}={})=>({name:re,init(o,{serializeQueryArgs:B},h){let k=o,{buildQueryHooks:b,buildMutationHook:J,usePrefetch:Y}=pe({api:o,moduleOptions:{batch:e,hooks:n,unstable__sideEffectsInRender:s},serializeQueryArgs:B,context:h});return L(k,{usePrefetch:Y}),L(h,{batch:e}),{injectEndpoint(E,z){if(de(z)){let{useQuery:r,useLazyQuery:Q,useLazyQuerySubscription:f,useQueryState:g,useQuerySubscription:u}=b(E);L(k.endpoints[E],{useQuery:r,useLazyQuery:Q,useLazyQuerySubscription:f,useQueryState:g,useQuerySubscription:u}),o[`use${$(E)}Query`]=r,o[`useLazy${$(E)}Query`]=Q}else if(ce(z)){let r=J(E);L(k.endpoints[E],{useMutation:r}),o[`use${$(E)}Mutation`]=r}}}}});N(P,require("@reduxjs/toolkit/query"),module.exports);var fe=require("@reduxjs/toolkit"),le=require("@reduxjs/toolkit"),Qe=require("react"),Te=require("react"),se=Be(require("react")),G=require("react-redux"),ge=require("@reduxjs/toolkit/query");function Re(e){let n=e.context||G.ReactReduxContext;if((0,Qe.useContext)(n))throw new Error((0,fe.formatProdErrorMessage)(35));let[T]=se.default.useState(()=>(0,le.configureStore)({reducer:{[e.api.reducerPath]:e.api.reducer},middleware:o=>o().concat(e.api.middleware)}));return(0,Te.useEffect)(()=>e.setupListeners===!1?void 0:(0,ge.setupListeners)(T.dispatch,e.setupListeners),[e.setupListeners,T.dispatch]),se.default.createElement(G.Provider,{store:T,context:n},e.children)}var Me=(0,Z.buildCreateApi)((0,Z.coreModule)(),ie());
//# sourceMappingURL=rtk-query-react.production.min.cjs.map